package com.pureut.storage.controller;

import com.pureut.storage.dto.AllotManagementDto;
import com.pureut.storage.service.MaterialSplittingService;
import com.pureut.storage.vo.AllotManagementVo;
import com.pureut.storage.vo.SplittingVo;
import com.sale.common.core.domain.R;
import com.sale.common.core.web.controller.BaseController;
import com.sale.common.mybatis.core.page.PageQuery;
import com.sale.common.mybatis.core.page.TableDataInfo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 物料拆分控制层
 */
@RestController
@RequestMapping("/materialSplitting")
public class MaterialSplittingController extends BaseController {

    /**
     * 物料拆分Service
     */
    @Resource
    MaterialSplittingService materialSplittingService;

    /**
     * 通过物料号码查询出号码信息
     */
    @GetMapping("/byMaterialNumber")
    public R<?> byMaterialNumber(String materialNumber) {
        //查询库存列表
        return  R.ok(materialSplittingService.byMaterialNumber(materialNumber));
    }

    /**
     * 平均拆分打印
     */
    @PostMapping("/average")
    public R<Void> average(@RequestBody SplittingVo splittingVo) throws Exception {
        return toAjax(materialSplittingService.average(splittingVo));
    }

    /**
     * 非平均拆分打印
     */
    @PostMapping("/notAverage")
    public R<Void> notAverage(@RequestBody SplittingVo splittingVo) throws Exception {
        return toAjax(materialSplittingService.notAverage(splittingVo));
    }
}
